$(function() {
	var oTable = new TableInit();
	oTable.Init();
	 $("#btn_query").click(function () {
	        $('#tb_warningThreshold').bootstrapTable('getOptions').pageNumber = 1;
	        $('#tb_warningThreshold').bootstrapTable('refresh');
	 });
	//头部监控对象类型
	 $('#monitoringType').selectpicker({
			size:10
		});
	 $.ajax({
			url:'/zhgl-jzstyxx-manage/warningThreshold/getMonitoringType',
			dataType:'json',
			success:function(data){
				if(data!=null){
					$("#monitoringType").append("<option value=''>请选择</option>");
					for(var i=0;i<data.length;i++){
						$("#monitoringType").append("<option value='"+data[i].dictCode+"'>"+data[i].dictName+"</option>");
					}
				}
				$('#monitoringType').selectpicker('refresh');
			}
		})
	 //头部预警指标
	 $('#monitoringItems').selectpicker({
			size:10
		});
	 var value = $('#monitoringType').val();	
	 $.ajax({
			url:'/zhgl-jzstyxx-manage/warningThreshold/getMonitoringItems',
			data:{"objType":value},
			dataType:'json',
			type:"POST",
			success:function(data){
				$("#monitoringItems").append("<option value=''>请选择</option>");
				if(data!=null){
					for(var i=0;i<data.length;i++){					
						$("#monitoringItems").append("<option value='"+data[i].dictCode+"'>"+data[i].dictName+"</option>");
					}
				}
				$('#monitoringItems').selectpicker('refresh');
			}
		});
	 
	 
	//预警指标
		$('#monitoringItems1').selectpicker({
			size:10
		});
		$('#monitoringItems1').append("<option value=''>请选择预警指标</option>");
		$('#monitoringItems1').selectpicker('refresh');
			//监控对象类型
			$('#monitoringType1').selectpicker({
				size:10
			});
		 $.ajax({
				url:'/zhgl-jzstyxx-manage/warningThreshold/getMonitoringType',
				dataType:'json',
				success:function(data){
					$("#monitoringType1").append("<option value=''>请选择监控对象类型</option>");
					if(data!=null){
						for(var i=0;i<data.length;i++){
							$("#monitoringType1").append("<option value='"+data[i].dictCode+"'>"+data[i].dictName+"</option>");
						}
					}
					$('#monitoringType1').selectpicker('refresh');
				}
			});
			 //监控时间段
		 $('#monitoringPeriod').selectpicker({
				size:10
			});
			 $.ajax({
					url:'/zhgl-jzstyxx-manage/warningThreshold/getMonitoringPeriod',
					dataType:'json',
					success:function(data){
						$("#monitoringPeriod").append("<option value=''>请选择时间段</option>");
						if(data!=null){
							for(var i=0;i<data.length;i++){
								$("#monitoringPeriod").append("<option value='"+data[i].dictCode+"'>"+data[i].dictName+"</option>");
							}
						}
						$('#monitoringPeriod').selectpicker('refresh');
					}
				});
			 //监控阈值设置
			 $('#threshold').selectpicker({
					size:10
				});
			 $.ajax({
					url:'/zhgl-jzstyxx-manage/warningThreshold/getThreshold',
					data:{"objType":"","kpiType":""},
					 dataType:'json',
					 type:"POST",
					success:function(data){
						$("#threshold").append("<option value=''>请选择阈值设置</option>");
						if(data!=null){
							for(var i=0;i<data.length;i++){
								$("#threshold").append("<option value='"+data[i].dictCode+"'>"+data[i].dictName+"</option>");
							}
						}
						$('#threshold').selectpicker('refresh');
					}
				});
			 //单位
			 $('#unit').selectpicker({
					size:10
			});
			 $.ajax({
				 url:'/zhgl-jzstyxx-manage/warningThreshold/getUnit',
				 data:{"objType":"","kpiType":""},
				 dataType:'json',
				 type:"POST",
				 success:function(data){
					 $("#unit").append("<option value=''>选择</option>");
					 if(data!=null){
						 for(var i=0;i<data.length;i++){
								$("#unit").append("<option value='"+data[i].dictCode+"'>"+data[i].dictName+"</option>");
							}
					 }
					 $('#unit').selectpicker('refresh');
				 }
			 })
			//预警通知人
			 $('#principal').selectpicker({
				 size:10
			 });
			 $.ajax({
					url:'/zhgl-jzstyxx-manage/warningThreshold/getPrincipal',
					dataType:'json',
					success:function(data){
						$("#principal").append("<option value=''>请选择预警通知人</option>");
						if(data!=null){
							for(var i=0;i<data.length;i++){
								$("#principal").append("<option value='"+data[i].id+"'>"+data[i].principal+"</option>");
							}
						}
						$('#principal').selectpicker('refresh');
					}
				});
			//通知方式
			 $('#warningType').selectpicker({
					size:10
			});
			 $.ajax({
					url:'/zhgl-jzstyxx-manage/warningThreshold/getWarningType',
					dataType:'json',
					success:function(data){
						$("#warningType").append("<option value=''>请选择通知方式</option>");
						if(data!=null){
							for(var i=0;i<data.length;i++){
								$("#warningType").append("<option value='"+data[i].dictCode+"'>"+data[i].dictName+"</option>");
							}
						}
						$('#warningType').selectpicker('refresh');
					}
				});
});

var TableInit = function() {
	var oTableInit = new Object();

	oTableInit.Init = function() {

		$("#tb_warningThreshold").bootstrapTable({
			url : '/zhgl-jzstyxx-manage/warningThreshold/getWarningThreshold',// 请求后台参数
			method : 'post', // 请求方式（*）
			toolbar : '#toolbar', // 工具按钮用哪个容器
			dataType : 'json',
			striped : true, // 是否显示行间隔色
			cache : false, // 是否使用缓存，默认为true，所以一般情况下需要设置一下这个属性（*）
			pagination : true, // 是否显示分页（*）
			singleSelect : false, // 单选CheckBox
			sortable : true, // 是否启用排序
			sortOrder : "asc", // 排序方式
			queryParams : oTableInit.queryParams,// 传递参数（*）
			sidePagination : "server", // 分页方式：client客户端分页，server服务端分页（*）
			pageNumber : 1, // 初始化加载第一页，默认第一页
			pageSize : 10, // 每页的记录行数（*）
			pageList : [ 10, 20, 30 ], // 可供选择的每页的行数（*）
			strictSearch : true,
			clickToSelect : true, // 是否启用点击选中行
			// height: 550, //行高，如果没有设置height属性，表格自动根据记录条数决定表格高度
			uniqueId : "id", // 每一行的唯一标识，一般为主键列
			cardView : false, // 是否显示详细视图
			rowStyle : function rowStyle(row, index) {
				return {
					css : {
						"font-size" : "14px",
						"height" : "15px",
						"line-height" : 1
					}
				};
			},
			detailView : false, // 是否显示父子表
			columns : [ {
				checkbox : true,
				width:'2%'
			}, {
				field : 'id',
				title : '序号',
				align : 'center',
				width:'4%',
				formatter : function(value, row, index) {
					var pageSize=$('#tb_warningThreshold').bootstrapTable('getOptions').pageSize;//通过表的#id可以得到每页多少条
        			var pageNumber=$('#tb_warningThreshold').bootstrapTable('getOptions').pageNumber;//通过表的#id可以得到当前第几页
					return pageSize*(pageNumber-1)+index+1;
				}
			}, {
				field : 'objtype',
				title : '监控对象类型',
				align : 'center',
				width : '12%'
			}, {
				field : 'kpiName',
				title : '预警指标',
				align : 'center',
				width : '12%'
			},  {
				field : 'periodTime',
				title : '扫描间隔',
				align : 'center',
				width : '12%'
			},  {
				field : 'threshold',
				title : '预警阈值',
				align : 'center',
				width : '12%'
			},  {
				field : 'principal',
				title : '预警通知人',
				align : 'center',
				width : '12%'
			},  {
				field : 'informWay',
				title : '通知方式',
				align : 'center',
				width : '12%'
			}
			]
		});
	};
	//得到查询的参数
    oTableInit.queryParams = function (params) {
        temp = {   
            limit: params.limit,   
            offset: params.offset,  
            kpiId:$("#monitoringItems").val(),
            objType:$("#monitoringType").val(),
        };
        return temp;
    };

    return oTableInit;
}

function textValue(){	
	$('#monitoringItems').html('');
	var value = $('#monitoringType').val();		
		$.ajax({
			url:'/zhgl-jzstyxx-manage/warningThreshold/getMonitoringItems',
			data:{"objType":value},
			dataType:'json',
			type:"POST",
			success:function(data){
				$("#monitoringItems").append("<option value=''>请选择</option>");
				if(data!=null){
					for(var i=0;i<data.length;i++){					
						$("#monitoringItems").append("<option value='"+data[i].dictCode+"'>"+data[i].dictName+"</option>");
					}
				}
				$('#monitoringItems').selectpicker('refresh');
			}
		});
	
}


//初始新增修改
function initialize(){
	$("#monitoringType1-error").remove();
	$("#monitoringItems1-error").remove();
	$("#monitoringPeriod-error").remove();
	$("#number-error").remove();	
	$("#threshold-error").remove();
	$("#unit-error").remove();
	$("#principal-error").remove();
	$("#warningType-error").remove();
	$("#cId").val("");
	$("#monitoringItems1").val("");
	$('#monitoringItems1').selectpicker('refresh');
	$("#monitoringPeriod").val("");
	$('#monitoringPeriod').selectpicker('refresh');
	$("#threshold").val("");
	$('#threshold').selectpicker('refresh');
	$("#principal").val("");
	$('#principal').selectpicker('refresh');
	$("#warningType").val("");
	$('#warningType').selectpicker('refresh');
	$("#monitoringType1").val("")
	$('#monitoringType1').selectpicker('refresh');
	$("#unit").val("")
	$('#unit').selectpicker('refresh');
	$("#number").val("");
	$('#addOrEditModal .bootstrap-select button').css("border-color","rgb(204,204,204)")
	
}
//新增
function Add(){
	initialize();
	$("#myModalLabel").text("新增")
	validform().resetForm();
	$(".error").removeClass("error");
	$("#addOrEditModal").modal('show');
}

//修改页面
function editById(){
	initialize();
	validform().resetForm();
	$(".error").removeClass("error");
	var url = "/zhgl-jzstyxx-manage/warningThreshold/getById";
	var arr = $('#tb_warningThreshold').bootstrapTable('getSelections');
	if(arr.length==0){
		window.wxc.xcConfirm("请选择需要操作的数据！", window.wxc.xcConfirm.typeEnum.confirm,{
			title: "提示",
			btn: parseInt("0001",2),
		})
	}else if(arr.length>1){
		window.wxc.xcConfirm("只能选择单条数据进行操作！", window.wxc.xcConfirm.typeEnum.confirm,{
			title: "提示",
			btn: parseInt("0001",2),
		});
	}else{
		$("#myModalLabel").text("修改")
		$("#addOrEditModal").modal('show');

		 $.ajax({
				url:url,
				type: 'post',
				data:{"id":arr[0].id},
				dataType: 'json',
				success:function(warningThreshold){
					$("#cId").val(warningThreshold.id);
					$("#monitoringType1").val(warningThreshold.objType);
					$('#monitoringType1').selectpicker('refresh');
					$("#monitoringPeriod").val(warningThreshold.monitoringPeriod);
					$('#monitoringPeriod').selectpicker('refresh');
					$("#number").val(warningThreshold.monitoringThreshold);
					$("#principal").val(warningThreshold.principalId);
					$('#principal').selectpicker('refresh');
					$("#warningType").val(warningThreshold.warningType);
					$('#warningType').selectpicker('refresh');
					$("#monitoringItems1").html('');
					$.ajax({
						url:'/zhgl-jzstyxx-manage/warningThreshold/getMonitoringItems',
						data:{"objType":warningThreshold.objType},
						dataType:'json',
						type:"POST",
						//async:false,
						success:function(data){
							$("#monitoringItems1").append("<option value=''>请选择预警指标</option>");
							if(data!=null){
								for(var i=0;i<data.length;i++){								
										$("#monitoringItems1").append("<option value='"+data[i].dictCode+"'>"+data[i].dictName+"</option>");
								}
								$("#monitoringItems1").val(warningThreshold.kpiId);
								$('#monitoringItems1').selectpicker('refresh');
							}
						}
					});	
					$("#threshold").html('');
					$.ajax({
						url:'/zhgl-jzstyxx-manage/warningThreshold/getThreshold',
						data:{"objType":warningThreshold.objType,"kpiType":warningThreshold.kpiId},
						 dataType:'json',
						 type:"POST",
						 //async:false,
						success:function(data){
							$("#threshold").append("<option value=''>请选择阈值设置</option>");
							if(data!=null){
								for(var i=0;i<data.length;i++){
									$("#threshold").append("<option value='"+data[i].dictCode+"'>"+data[i].dictName+"</option>");
								}
								$("#threshold").val(warningThreshold.comparisonOperators);
								$('#threshold').selectpicker('refresh');
							}
							$('#threshold').selectpicker('refresh');
						}
					});
					$("#unit").html('');
					$.ajax({
						 url:'/zhgl-jzstyxx-manage/warningThreshold/getUnit',
						 data:{"objType":warningThreshold.objType,"kpiType":warningThreshold.kpiId},
						 dataType:'json',
						 //async:false,
						 type:"POST",
						 success:function(data){
							 $("#unit").append("<option value=''>选择</option>");
							 if(data!=null){
								 for(var i=0;i<data.length;i++){
										$("#unit").append("<option value='"+data[i].dictCode+"'>"+data[i].dictName+"</option>");
									}
								 $("#unit").val(warningThreshold.unitCode);
								$('#unit').selectpicker('refresh');
							 }
							 $('#unit').selectpicker('refresh');
						 }
					 })
					
					
				}
			});
	}
}

var b=0;//定义全局变量控制onchang事件

//保存
function saveAddOrEdit(){
	
	$("#monitoringPeriod").attr("onChange","monitoringPeriod1()");
	$("#monitoringPeriod").selectpicker("refresh");
	
	$("#threshold").attr("onChange","threshold1()");
	$("#threshold").selectpicker("refresh");
	
	$("#principal").attr("onChange","principal1()");
	$("#principal").selectpicker("refresh");
	
	$("#warningType").attr("onChange","warningType1()");
	$("#warningType").selectpicker("refresh");
	
	b=1;
	
	if (validform().form()) {
		var cId = $("#cId").val();
		var monitoringItems = $("#monitoringItems1").val();
		var monitoringType = $("#monitoringType1").val();
		var monitoringPeriod=$("#monitoringPeriod").val();
		var threshold=$("#threshold").val();
		var number=$("#number").val();
		var principal=$("#principal").val();
		var warningType=$("#warningType").val();
		var unitCode =$("#unit").val();
		var kpiName=$("#monitoringType1 option:selected").text()+" "+$("#monitoringItems1 option:selected").text();
		var datapost = {
			"id":cId,
			"kpiId":monitoringItems,
			"objType":monitoringType,
			"monitoringPeriod":monitoringPeriod,
			"comparisonOperators":threshold,
			"monitoringThreshold":number,
			"principalId":principal,
			"warningType":warningType,
			"unitCode":unitCode,
			"kpiName":kpiName
		}
		var url;
		if(cId!=""){
			url ="/zhgl-jzstyxx-manage/warningThreshold/changeWarningThreshold";
		}else{
			url="/zhgl-jzstyxx-manage/warningThreshold/addWarningThreshold"
		}
		$.ajax({
			url:url,
			data:datapost,
			type:"POST",  
			dataType:"json",
			success:function(result){
				if(result.state==200){
					window.wxc.xcConfirm(result.message, window.wxc.xcConfirm.typeEnum.confirm,{
						title: "提示",
						btn: parseInt("0001",2),
					});
				}else if(result.state==400){
					window.wxc.xcConfirm(result.message, window.wxc.xcConfirm.typeEnum.confirm,{
						title: "提示",
						btn: parseInt("0001",2),
					});
				}
		    	 $('#tb_warningThreshold').bootstrapTable('refresh');
				 $("#addOrEditModal").modal('hide');
				}
		})
	}
}
//删除
function deleteByIds(){
	 var arr = $("#tb_warningThreshold").bootstrapTable('getSelections');
	 var dataNum = arr.length;	 
	 if (arr.length == 0) {
		 window.wxc.xcConfirm("请选择你要删除的数据！", window.wxc.xcConfirm.typeEnum.confirm,{
				title: "提示",
				btn: parseInt("0001",2),
			});
	 } else {
		var ids = "";
	    for(var a = 0; a<arr.length; a++) {
	    	ids+=arr[a].id+",";
	    	}
	    ids=ids.substring(0,ids.length-1);
	 var url = '/zhgl-jzstyxx-manage/warningThreshold/deleteByIds';
	 window.wxc.xcConfirm("确认删除吗？", window.wxc.xcConfirm.typeEnum.confirm,{
			title: "提示",
			onOk:  function(){
					$.ajax({
                		type: 'POST',
                		url: url,
                		data:{'ids':ids},
                		success: function (result) {
                			if(result.state==200){
                				window.wxc.xcConfirm(result.message, window.wxc.xcConfirm.typeEnum.confirm,{
            						title: "提示",
            						btn: parseInt("0001",2),
            					});               					
                			}
                			$('#tb_warningThreshold').bootstrapTable('refresh');
                }
            })	
		}
	 })
	}
}


//校验
function validform() {
    return $("#addOrEdit").validate({
        rules: {
        	monitoringItems1:{
        		judgenull1:true,
           },
           monitoringType1: {
        	   judgenull2:true,
            },
            monitoringPeriod:{
            	judgenull3:true,
            },
            threshold:{
            	judgenull4:true,
            },
            number:{
            	required:true,
            },
            principal:{
            	judgenull5:true,
            },
            warningType:{
            	judgenull6:true,
            },
            unit:{
            	judgenull7:true,
            }
        },
		     messages: {
		    	 monitoringItems1:{
		    		 judgenull1:jQuery.validator.addMethod("judgenull1", function(value, element) {
							if(value==""){
								$('button[data-id="monitoringItems1"]').css("boder","1px solid");
								$('button[data-id="monitoringItems1"]').css("border-color","red");
							}
							return value!=""
						},"请选择预警指标")
		        },
		        monitoringType1: {
		        	judgenull2:jQuery.validator.addMethod("judgenull2", function(value, element) {
						if(value==""){
							$('button[data-id="monitoringType1"]').css("boder","1px solid");
							$('button[data-id="monitoringType1"]').css("border-color","red");
						}
						return value!=""
					},"请选择监控对象类型")
		        },
	            monitoringPeriod:{
	            	judgenull3:jQuery.validator.addMethod("judgenull3", function(value, element) {
						if(value==""){
							$('button[data-id="monitoringPeriod"]').css("boder","1px solid");
							$('button[data-id="monitoringPeriod"]').css("border-color","red");
						}
						return value!=""
					},"请选择扫描间隔")
	            },
	            threshold:{
	            	judgenull4:jQuery.validator.addMethod("judgenull4", function(value, element) {
						if(value==""){
							$('button[data-id="threshold"]').css("boder","1px solid");
							$('button[data-id="threshold"]').css("border-color","red");
						}
						return value!=""
					},"请选择预警阈值")
	            },
	            number:{
	            	required:"数值不能为空"
	            },
	            principal:{
	            	judgenull5:jQuery.validator.addMethod("judgenull5", function(value, element) {
						if(value==""){

							$('button[data-id="principal"]').css("boder","1px solid");
							$('button[data-id="principal"]').css("border-color","red");
						}
						return value!=""
					},"请选择预警人员")
	            },
	            warningType:{
	            	judgenull6:jQuery.validator.addMethod("judgenull6", function(value, element) {
	            		if(value==""){
							$('button[data-id="warningType"]').css("boder","1px solid");
							$('button[data-id="warningType"]').css("border-color","red");
						}
						return value!=""
					},"请选择通知方式")
	            },
	            unit:{
	            	judgenull7:jQuery.validator.addMethod("judgenull7", function(value, element) {
	            		if(value==""){
							$('button[data-id="unit"]').css("boder","1px solid");
							$('button[data-id="unit"]').css("border-color","red");
						}
						return value!=""
					},"必选")
	            }
		 },
    })
}
var value2
//新增预警指标改变
function textValue3(){
	$('#threshold').html('');
	$('#unit').html('');
	value2=$('#monitoringItems1').val();
	if(b==1){
		var a = document.getElementById("monitoringItems1-error");
		if(a){
			var value= $("#monitoringItems1").val();
			if(value!=""){
				$('button[data-id="monitoringItems1"]').css("border-color","rgb(204,204,204)");
				$("#monitoringItems1-error").css("display","none")
			}else{
				$('button[data-id="monitoringItems1"]').css("boder","1px solid");
				$('button[data-id="monitoringItems1"]').css("border-color","red");
				$("#monitoringItems1-error").css("display","inline-block")
			}
		}	
	}
	unitAndThreshold(value1,value2)
}


var value1;
function textValue2(){
	$('#threshold').html('');
	$('#unit').html('');
	value1=$("#monitoringType1").val();
	var value= $("#monitoringType1").val();
	$('#monitoringItems1').html('');
	if(b==1){
		var a = document.getElementById("monitoringType1-error");
		if(a){
			if(value!=""){
				$('button[data-id="monitoringType1"]').css("border-color","rgb(204,204,204)");
				$("#monitoringType1-error").css("display","none")
			}else{
				$('button[data-id="monitoringType1"]').css("boder","1px solid");
				$('button[data-id="monitoringType1"]').css("border-color","red");
				$("#monitoringType1-error").css("display","inline-block")
			}
		}
	}
	
	if(value!=""){
		 $.ajax({
				url:'/zhgl-jzstyxx-manage/warningThreshold/getMonitoringItems',
				data:{"objType":value},
				dataType:'json',
				type:"POST",
				success:function(data){
					$("#monitoringItems1").append("<option value=''>请选择预警指标</option>");
					if(data!=null){
						for(var i=0;i<data.length;i++){								
								$("#monitoringItems1").append("<option value='"+data[i].dictCode+"'>"+data[i].dictName+"</option>");
						}
					}
					$('#monitoringItems1').selectpicker('refresh');
				}
			});

	}else{
		$("#monitoringItems1").append("<option value=''>请选择预警指标</option>");
		$('#monitoringItems1').selectpicker('refresh');
	} 	
	value2='';
	unitAndThreshold(value1,value2);
}
//监控时间段
function monitoringPeriod1(){
	var value= $("#monitoringPeriod").val();
	var a = document.getElementById("monitoringPeriod-error");
	if(a){
		if(value!=""){
			$('button[data-id="monitoringPeriod"]').css("border-color","rgb(204,204,204)");
			$("#monitoringPeriod-error").css("display","none")
		}else{
			$('button[data-id="monitoringPeriod"]').css("boder","1px solid");
			$('button[data-id="monitoringPeriod"]').css("border-color","red");
			$("#monitoringPeriod-error").css("display","inline-block")
		}
	}
}

function threshold1(){
	var value= $("#threshold").val();
	var a = document.getElementById("threshold-error");
	if(a){
		if(value!=""){
			$('button[data-id="threshold"]').css("border-color","rgb(204,204,204)");
			$("#threshold-error").css("display","none")
		}else{
			$('button[data-id="threshold"]').css("boder","1px solid");
			$('button[data-id="threshold"]').css("border-color","red");
			$("#threshold-error").css("display","inline-block")
		}
	}
}
//通知人
function principal1(){
	var value= $("#principal").val();
	var a = document.getElementById("principal-error");
	if(a){
		if(value!=""){
			$('button[data-id="principal"]').css("border-color","rgb(204,204,204)");
			$("#principal-error").css("display","none")
		}else{
			$('button[data-id="principal"]').css("boder","1px solid");
			$('button[data-id="principal"]').css("border-color","red");
			$("#principal-error").css("display","inline-block")
		}
	}
}
//监控对象类型
function warningType1(){
	var value= $("#warningType").val();
	var a = document.getElementById("warningType-error");
	if(a){
		if(value!=""){
			$('button[data-id="warningType"]').css("border-color","rgb(204,204,204)");
			$("#warningType-error").css("display","none")
		}else{
			$('button[data-id="warningType"]').css("boder","1px solid");
			$('button[data-id="warningType"]').css("border-color","red");
			$("#warningType-error").css("display","inline-block")
		}
	}
}
//单位
function unit1(){
	var value= $("#unit").val();
	if(b==1){
		var a = document.getElementById("unit-error");
		if(a){
			if(value!=""){
				$('button[data-id="unit"]').css("border-color","rgb(204,204,204)");
				$("#unit-error").css("display","none")
			}else{
				$('button[data-id="unit"]').css("boder","1px solid");
				$('button[data-id="unit"]').css("border-color","red");
				$("#unit-error").css("display","inline-block")
			}
		}
	}
}

function unitAndThreshold(value1,value2){
	$.ajax({
		url:'/zhgl-jzstyxx-manage/warningThreshold/getThreshold',
		data:{"objType":value1,"kpiType":value2},
		 dataType:'json',
		 type:"POST",
		success:function(data){
			$("#threshold").append("<option value=''>请选择阈值设置</option>");
			if(data!=null){
				for(var i=0;i<data.length;i++){
					$("#threshold").append("<option value='"+data[i].dictCode+"'>"+data[i].dictName+"</option>");
				}
			}
			$('#threshold').selectpicker('refresh');
		}
	});
	
	$.ajax({
		 url:'/zhgl-jzstyxx-manage/warningThreshold/getUnit',
		 data:{"objType":value1,"kpiType":value2},
		 dataType:'json',
		 type:"POST",
		 success:function(data){
			 $("#unit").append("<option value=''>选择</option>");
			 if(data!=null){
				 for(var i=0;i<data.length;i++){
						$("#unit").append("<option value='"+data[i].dictCode+"'>"+data[i].dictName+"</option>");
					}
			 }
			 $('#unit').selectpicker('refresh');
		 }
	 })
}
